From: Olaf Hering Date: Fri, 10 Jun 2011 08:47:10 +0000 (+0200) Subject: xenpaging: drop xc.c, move xc_mem_paging_flush_ioemu_cache X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10147 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=160e87fd4961febf88b6cc8b192ffb597f2cee12;p=xen.git xenpaging: drop xc.c, move xc_mem_paging_flush_ioemu_cache Move xc_mem_paging_flush_ioemu_cache() into xenpaging and massage it a bit to use the required members from xenpaging_t. Also update type of rc to match xs_write() return value. Signed-off-by: Olaf Hering Committed-by: Ian Jackson --- diff --git a/tools/xenpaging/xc.c b/tools/xenpaging/xc.c index 26b8d0fd72..211977504d 100644 --- a/tools/xenpaging/xc.c +++ b/tools/xenpaging/xc.c @@ -31,24 +31,6 @@ -int xc_mem_paging_flush_ioemu_cache(domid_t domain_id) -{ - struct xs_handle *xsh = NULL; - char path[80]; - int rc; - - sprintf(path, "/local/domain/0/device-model/%u/command", domain_id); - - xsh = xs_daemon_open(); - if ( xsh == NULL ) - return -EIO; - - rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); - - xs_daemon_close(xsh); - - return rc ? 0 : -1; -} int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms) { diff --git a/tools/xenpaging/xc.h b/tools/xenpaging/xc.h index f0e714cfe1..665bcf5c69 100644 --- a/tools/xenpaging/xc.h +++ b/tools/xenpaging/xc.h @@ -37,7 +37,6 @@ -int xc_mem_paging_flush_ioemu_cache(domid_t domain_id); int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms); diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c index 09db0b4499..405113a492 100644 --- a/tools/xenpaging/xenpaging.c +++ b/tools/xenpaging/xenpaging.c @@ -48,6 +48,20 @@ static void close_handler(int sig) unlink(filename); } +static int xenpaging_mem_paging_flush_ioemu_cache(xenpaging_t *paging) +{ + struct xs_handle *xsh = paging->xs_handle; + domid_t domain_id = paging->mem_event.domain_id; + char path[80]; + bool rc; + + sprintf(path, "/local/domain/0/device-model/%u/command", domain_id); + + rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); + + return rc == true ? 0 : -1; +} + static void *init_page(void) { void *buffer; @@ -484,7 +498,7 @@ static int evict_victim(xenpaging_t *paging, else { if ( j++ % 1000 == 0 ) - if ( xc_mem_paging_flush_ioemu_cache(paging->mem_event.domain_id) ) + if ( xenpaging_mem_paging_flush_ioemu_cache(paging) ) ERROR("Error flushing ioemu cache"); } }